package com.bang.study.producer;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @ClassName: RestController
 * @Desc: TODO
 * @Auther: <Bang>
 * @Date: 2020/05/07 11:29
 * @Version: 1.0
 * @Modified By:
 */
@org.springframework.web.bind.annotation.RestController
public class RestController {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @RequestMapping("/send")
    public String send(String msg) {
        rocketMQTemplate.convertAndSend("BOOT_TOPIC", "hello springboot " + msg);
        return "success";
    }

    @RequestMapping("/send2")
    public String send2(String msg) {
        rocketMQTemplate.convertAndSend("ORDER_BOOT_TOPIC", "hello ORDER_BOOT_TOPIC " + msg);
        return "success";
    }
}
